package com.yn.pet.controller.pc.response;


import com.yn.common.utils.bean.BeanUtils;
import com.yn.pet.bus.entity.GenFence;
import com.yn.pet.bus.enums.FenceTypeEnum;
import lombok.Data;

@Data
public class FenceQueryResponse {

    // 围栏id
    private Long fenceId;

    //设备ID
    private Long deviceId;

    //围栏名称
    private String fenceName;

    //围栏类型 1-圆形 2-多边形
    private Integer fenceType;

    //栏目类型字符串
    private String fenceTypeName;

    //中心纬度(圆形)
    private Double centerLat;

    //中心经度(圆形)
    private Double centerLng;

    //半径(圆形)
    private Integer radius;


    //多边形顶点坐标(json)
    private String vertices;

    //围栏地址
    private String fenceAddress;


    //状态 0-禁用 1-启用
    private Integer useStatus;

    public static FenceQueryResponse transform(GenFence fence){
        if(fence == null){
            return null;
        }
        FenceQueryResponse response = new FenceQueryResponse();
        BeanUtils.copyProperties(fence, response);
        response.setFenceTypeName(FenceTypeEnum.getByCode(fence.getFenceType()).getName());
        return response;
    }


}
